# Makefile for shared

LIB_VERMAJOR = 0
LIB_VERMINOR = 1
LIB_FILENAME = libshare.so
LIB_STATIC   = libshare.a

LIB_CFLAGS  = $(CFLAGS) -shared -fPIC -I. -DMDC_MDIO_OPERATION -D_LITTLE_ENDIAN
LIB_LDFLAGS = $(LDFLAGS) -Wl,-soname,$(LIB_FILENAME).$(LIB_VERMAJOR).$(LIB_VERMINOR)

CFLAGS	+= -I. $(TARGET_CFLAGS)


ALL_SRCS = $(shell find ./ -name \*.c)

OBJS += $(ALL_SRCS:.c=.o)

SRCS = $(ALL_SRCS)

HEADERS =

all: shared

$(LIB_OBJS): $(HEADERS)

shared: $(OBJS)
	$(AR) -r $(LIB_STATIC) $(OBJS)
	$(CC) $(SRCS) -fPIC  -shared  $(CFLAGS) -o $(LIB_FILENAME)
	mv $(LIB_STATIC) $(TARGET_DIR)
	mv $(LIB_FILENAME) $(TARGET_DIR)
	
clean:
	rm -fr $(LIB_FILENAME) *.o *.so *.a
	rm -rf ./*.o ./bitree/*.o ./log/*.o ./memory/*.o ./sys/*.o ./time/*.o

install: all
	$(STRIP) $(LIB_FILENAME)